<template>
  <div>
    <el-dialog :title="Title" v-model="showDialog" width="50%" :before-close="handleClose" :close-on-click-modal="false">
      <el-divider></el-divider>
      <slot name="content"> </slot>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="closeDialog">取 消</el-button>
          <el-button type="primary" @click="showDialog = false">确 定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
<script>
export default {
  props: {
    showDialog: {
      type: Boolean,
      default: false
    },
    Title: {
      type: String,
      default: '默认标题'
    }
  },
  setup(props, context) {
    //更新父组件
    function closeDialog() {
      context.emit('close', false)
    }
    return {
      closeDialog
    }
  }
}
</script>

<style lang="less" scoped>
.el-divider {
  margin: 0;
}
</style>
